﻿<Window x:Class="DataBindingSample.DataBindingSampleWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ve="clr-namespace:InfoStrat.VE;assembly=InfoStrat.VE"
    xmlns:local="clr-namespace:DataBindingSample"
    Title="DataBindingSample" Height="600" Width="800">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="StandardPushPinTemplate">
                <ve:VEPushPin Latitude="{Binding Latitude}"
                              Longitude="{Binding Longitude}"
                              PushPinBackground="Green"
                              PinVisible="{Binding IsVisible}">
                    <TextBlock Text="{Binding Label}" />
                </ve:VEPushPin>
            </DataTemplate>
            
            <DataTemplate x:Key="CustomPushPinTemplate">
                <local:CustomPushPin Latitude="{Binding Latitude}"
                                     Longitude="{Binding Longitude}"
                                     PushPinBackground="Blue"
                                     PinVisible="{Binding IsVisible}">
                    <TextBlock Text="{Binding Label}" />
                </local:CustomPushPin>
            </DataTemplate>
            
            <local:PushPinTemplateSelector x:Key="templateSelector"
                                           Template1="{StaticResource StandardPushPinTemplate}"
                                           Template2="{StaticResource CustomPushPinTemplate}" />

        </Grid.Resources>
        <ve:VEMap Name="map"
                  LatLong="38.9444195081574,-77.0630161230201"
                  Altitude="2000" 
                  
                  ItemsSource="{Binding Locations}"
                  ItemTemplateSelector="{StaticResource templateSelector}">
        </ve:VEMap>
        <DockPanel Margin="20,10,0,10">
            <Border DockPanel.Dock="Left"
                    CornerRadius="20"
                    Background="#77FFFFFF">
                <StackPanel Margin="20">
                    <Button Name="btnResetData"
                            Content="Reset Data"
                            Margin="5"
                            Click="btnResetData_Click" />
                    <CheckBox Name="cbxGroup1"
                              Content="Group 1 Visible"
                              Margin="5"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsGroup1Visible}" />
                    <CheckBox Name="cbxGroup2"
                              Content="Group 2 Visible"
                              Margin="5"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsGroup2Visible}" />
                    <CheckBox Name="cbxGroup3"
                              Content="Group 3 Visible"
                              Margin="5"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsGroup3Visible}" />
                    <CheckBox Name="cbxGroup4"
                              Content="Group 4 Visible"
                              Margin="5"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsGroup4Visible}" />
                </StackPanel>
            </Border>

            <Grid>
            </Grid>
        </DockPanel>
    </Grid>
</Window>
